//自定义插件
//对外暴露插件对象
import svgIcon from '@/components/common/svgIcon/index.vue'
import {Component} from "vue";
//引入element-plus提供的全部图标
import * as ElementPlusIcon  from '@element-plus/icons-vue'

type GlobalComponent = {
    [key:string]: Component
}

const allGlobalComponent: GlobalComponent = {
    svgIcon
}

export default {
    install: (app:any) => {
        Object.keys(allGlobalComponent).forEach(key => {
            app.component(key, allGlobalComponent[key]);
        });
        //将element-plus的图标注册为全局组件
        Object.entries(ElementPlusIcon).forEach(([name, component]) => {
            app.component(name, component);
        })
     }
}
